package com.wangcang.widgetlibrary.activity;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.TextView;

import com.wangcang.widgetlibrary.R;
import com.wangcang.widgetlibrary.address.AddressSelectDemoDialog;

/**
 * Created by feng.gao on 2017/6/22.
 */

public class AddressSelectDemoActivity extends Activity {
    private TextView mTextView;
    AddressSelectDemoDialog dialogSelectAddressUpdate;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_address_select_layout);
        mTextView = (TextView) findViewById(R.id.tv);
        findViewById(R.id.btn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (dialogSelectAddressUpdate == null) {
                    dialogSelectAddressUpdate = new AddressSelectDemoDialog(AddressSelectDemoActivity.this);
                    dialogSelectAddressUpdate.setListener(new AddressSelectDemoDialog.AddressListener() {
                        @Override
                        public void setAddress(String province, String city, String district, String street) {
                            mTextView.setText(province + city + district + street);
                        }
                    });
                }
                dialogSelectAddressUpdate.setCancelable(true);
                dialogSelectAddressUpdate.show();
            }
        });
    }

}
